{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
   },
   "outputs": [],
   "source": [
    "from PIL import Image\n",
    "from config import config\n",
    "from train_and_eval import train_test_all"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Starting training on ./data/BSD100/img_001.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03328603098444498\n",
      "Finish evaluation\n",
      "Average psnr: 25.00168601427235\n",
      "Starting training on ./data/BSD100/img_002.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024370031684496016\n",
      "Finish evaluation\n",
      "Average psnr: 28.988525538758488\n",
      "Starting training on ./data/BSD100/img_003.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03904849852639982\n",
      "Finish evaluation\n",
      "Average psnr: 23.668093277906145\n",
      "Starting training on ./data/BSD100/img_004.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.022580634109597906\n",
      "Finish evaluation\n",
      "Average psnr: 33.137699151896115\n",
      "Starting training on ./data/BSD100/img_005.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03244631481833414\n",
      "Finish evaluation\n",
      "Average psnr: 28.244627767659143\n",
      "Starting training on ./data/BSD100/img_006.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.01802092099595937\n",
      "Finish evaluation\n",
      "Average psnr: 35.01120857835548\n",
      "Starting training on ./data/BSD100/img_007.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04039455553903281\n",
      "Finish evaluation\n",
      "Average psnr: 29.433856451500525\n",
      "Starting training on ./data/BSD100/img_008.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04463464742403858\n",
      "Finish evaluation\n",
      "Average psnr: 20.529650742379637\n",
      "Starting training on ./data/BSD100/img_009.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03735172465983991\n",
      "Finish evaluation\n",
      "Average psnr: 29.927135356714704\n",
      "Starting training on ./data/BSD100/img_010.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024268114114359383\n",
      "Finish evaluation\n",
      "Average psnr: 31.497242026332543\n",
      "Starting training on ./data/BSD100/img_011.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04211185437786506\n",
      "Finish evaluation\n",
      "Average psnr: 26.7627392134912\n",
      "Starting training on ./data/BSD100/img_012.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.036033802222055475\n",
      "Finish evaluation\n",
      "Average psnr: 25.399148732492392\n",
      "Starting training on ./data/BSD100/img_013.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.027148725493684977\n",
      "Finish evaluation\n",
      "Average psnr: 33.48752162044035\n",
      "Starting training on ./data/BSD100/img_014.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.027226272384147442\n",
      "Finish evaluation\n",
      "Average psnr: 26.05007240656964\n",
      "Starting training on ./data/BSD100/img_015.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.031885585135386474\n",
      "Finish evaluation\n",
      "Average psnr: 27.249538926902876\n",
      "Starting training on ./data/BSD100/img_016.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.050876867695480665\n",
      "Finish evaluation\n",
      "Average psnr: 28.712791943940942\n",
      "Starting training on ./data/BSD100/img_017.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.014593236113590332\n",
      "Finish evaluation\n",
      "Average psnr: 31.06499262171612\n",
      "Starting training on ./data/BSD100/img_018.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.019616034058035095\n",
      "Finish evaluation\n",
      "Average psnr: 29.684270035275787\n",
      "Starting training on ./data/BSD100/img_019.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03184688070666177\n",
      "Finish evaluation\n",
      "Average psnr: 26.780212625199454\n",
      "Starting training on ./data/BSD100/img_020.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03446147947548393\n",
      "Finish evaluation\n",
      "Average psnr: 27.67567513881444\n",
      "Starting training on ./data/BSD100/img_021.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04515292735729493\n",
      "Finish evaluation\n",
      "Average psnr: 24.608012569849997\n",
      "Starting training on ./data/BSD100/img_022.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04351010633713622\n",
      "Finish evaluation\n",
      "Average psnr: 25.743428291455267\n",
      "Starting training on ./data/BSD100/img_023.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03838244980793034\n",
      "Finish evaluation\n",
      "Average psnr: 21.70034570696991\n",
      "Starting training on ./data/BSD100/img_024.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.028138510366687814\n",
      "Finish evaluation\n",
      "Average psnr: 28.389231978623243\n",
      "Starting training on ./data/BSD100/img_025.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.032628427721901714\n",
      "Finish evaluation\n",
      "Average psnr: 30.4715309141805\n",
      "Starting training on ./data/BSD100/img_026.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03430794395150516\n",
      "Finish evaluation\n",
      "Average psnr: 29.879809254662494\n",
      "Starting training on ./data/BSD100/img_027.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03297064070335979\n",
      "Finish evaluation\n",
      "Average psnr: 29.96168198205592\n",
      "Starting training on ./data/BSD100/img_028.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.020301797863129026\n",
      "Finish evaluation\n",
      "Average psnr: 31.5098069074871\n",
      "Starting training on ./data/BSD100/img_029.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.014813570990336741\n",
      "Finish evaluation\n",
      "Average psnr: 33.51860123639395\n",
      "Starting training on ./data/BSD100/img_030.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05456100263369039\n",
      "Finish evaluation\n",
      "Average psnr: 21.32064503663752\n",
      "Starting training on ./data/BSD100/img_031.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.028422353278444983\n",
      "Finish evaluation\n",
      "Average psnr: 32.07795878856195\n",
      "Starting training on ./data/BSD100/img_032.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.056511457961552554\n",
      "Finish evaluation\n",
      "Average psnr: 18.18300267352962\n",
      "Starting training on ./data/BSD100/img_033.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04138105355799655\n",
      "Finish evaluation\n",
      "Average psnr: 27.827631133779498\n",
      "Starting training on ./data/BSD100/img_034.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03223964899632344\n",
      "Finish evaluation\n",
      "Average psnr: 26.106166312653173\n",
      "Starting training on ./data/BSD100/img_035.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.019348679750897754\n",
      "Finish evaluation\n",
      "Average psnr: 36.54713900217317\n",
      "Starting training on ./data/BSD100/img_036.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.038741715321809395\n",
      "Finish evaluation\n",
      "Average psnr: 29.353435977540485\n",
      "Starting training on ./data/BSD100/img_037.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025812618978999263\n",
      "Finish evaluation\n",
      "Average psnr: 24.07785801702562\n",
      "Starting training on ./data/BSD100/img_038.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025752470429082026\n",
      "Finish evaluation\n",
      "Average psnr: 28.98967305634709\n",
      "Starting training on ./data/BSD100/img_039.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0304601414514804\n",
      "Finish evaluation\n",
      "Average psnr: 26.318484211259424\n",
      "Starting training on ./data/BSD100/img_040.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025505692987621394\n",
      "Finish evaluation\n",
      "Average psnr: 37.17777624623396\n",
      "Starting training on ./data/BSD100/img_041.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03713127514371647\n",
      "Finish evaluation\n",
      "Average psnr: 28.81834956461934\n",
      "Starting training on ./data/BSD100/img_042.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.030149530860268905\n",
      "Finish evaluation\n",
      "Average psnr: 26.35245081285418\n",
      "Starting training on ./data/BSD100/img_043.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.026854756680166916\n",
      "Finish evaluation\n",
      "Average psnr: 27.968545015506628\n",
      "Starting training on ./data/BSD100/img_044.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.035358983361020134\n",
      "Finish evaluation\n",
      "Average psnr: 28.783225001497193\n",
      "Starting training on ./data/BSD100/img_045.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02768499723272857\n",
      "Finish evaluation\n",
      "Average psnr: 24.477723964892803\n",
      "Starting training on ./data/BSD100/img_046.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.01323264629435611\n",
      "Finish evaluation\n",
      "Average psnr: 32.84169154918205\n",
      "Starting training on ./data/BSD100/img_047.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04359081799919232\n",
      "Finish evaluation\n",
      "Average psnr: 25.22571124291403\n",
      "Starting training on ./data/BSD100/img_048.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.029762163137437566\n",
      "Finish evaluation\n",
      "Average psnr: 26.384970932827617\n",
      "Starting training on ./data/BSD100/img_049.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05212107896106985\n",
      "Finish evaluation\n",
      "Average psnr: 29.524706988493108\n",
      "Starting training on ./data/BSD100/img_050.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.013868750218292326\n",
      "Finish evaluation\n",
      "Average psnr: 32.761475096928066\n",
      "Starting training on ./data/BSD100/img_051.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03507717568510517\n",
      "Finish evaluation\n",
      "Average psnr: 26.471759612157072\n",
      "Starting training on ./data/BSD100/img_052.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03556196269407321\n",
      "Finish evaluation\n",
      "Average psnr: 24.692325778666383\n",
      "Starting training on ./data/BSD100/img_053.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.016627183345570326\n",
      "Finish evaluation\n",
      "Average psnr: 33.43944136464038\n",
      "Starting training on ./data/BSD100/img_054.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.014269416917689851\n",
      "Finish evaluation\n",
      "Average psnr: 33.909718450541966\n",
      "Starting training on ./data/BSD100/img_055.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03653588731249891\n",
      "Finish evaluation\n",
      "Average psnr: 29.90802628215789\n",
      "Starting training on ./data/BSD100/img_056.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03621009555334556\n",
      "Finish evaluation\n",
      "Average psnr: 27.395148025381868\n",
      "Starting training on ./data/BSD100/img_057.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0488027842796961\n",
      "Finish evaluation\n",
      "Average psnr: 18.407660454772632\n",
      "Starting training on ./data/BSD100/img_058.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02311486426458278\n",
      "Finish evaluation\n",
      "Average psnr: 28.745191410740336\n",
      "Starting training on ./data/BSD100/img_059.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.014579410889853928\n",
      "Finish evaluation\n",
      "Average psnr: 31.613943236559983\n",
      "Starting training on ./data/BSD100/img_060.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02093889139080827\n",
      "Finish evaluation\n",
      "Average psnr: 27.761666063880295\n",
      "Starting training on ./data/BSD100/img_061.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.015256643295319129\n",
      "Finish evaluation\n",
      "Average psnr: 32.30393630761285\n",
      "Starting training on ./data/BSD100/img_062.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02209764677099573\n",
      "Finish evaluation\n",
      "Average psnr: 30.29528606916507\n",
      "Starting training on ./data/BSD100/img_063.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.028406494968060376\n",
      "Finish evaluation\n",
      "Average psnr: 36.145025660646645\n",
      "Starting training on ./data/BSD100/img_064.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.040463236866782215\n",
      "Finish evaluation\n",
      "Average psnr: 26.618496718152727\n",
      "Starting training on ./data/BSD100/img_065.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04272251262623611\n",
      "Finish evaluation\n",
      "Average psnr: 23.162801776486145\n",
      "Starting training on ./data/BSD100/img_066.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03588992052067549\n",
      "Finish evaluation\n",
      "Average psnr: 25.55420362916964\n",
      "Starting training on ./data/BSD100/img_067.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.00997376970773388\n",
      "Finish evaluation\n",
      "Average psnr: 38.67293013085256\n",
      "Starting training on ./data/BSD100/img_068.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.06415559984279207\n",
      "Finish evaluation\n",
      "Average psnr: 23.51097789631071\n",
      "Starting training on ./data/BSD100/img_069.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03455528264634202\n",
      "Finish evaluation\n",
      "Average psnr: 23.810051404456416\n",
      "Starting training on ./data/BSD100/img_070.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.031255791338446096\n",
      "Finish evaluation\n",
      "Average psnr: 31.67266673272879\n",
      "Starting training on ./data/BSD100/img_071.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.020609813229773837\n",
      "Finish evaluation\n",
      "Average psnr: 31.663545254888636\n",
      "Starting training on ./data/BSD100/img_072.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.036299495393261695\n",
      "Finish evaluation\n",
      "Average psnr: 27.7463018173885\n",
      "Starting training on ./data/BSD100/img_073.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03459908219255369\n",
      "Finish evaluation\n",
      "Average psnr: 23.80341912862605\n",
      "Starting training on ./data/BSD100/img_074.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03220805605669457\n",
      "Finish evaluation\n",
      "Average psnr: 27.803527533518952\n",
      "Starting training on ./data/BSD100/img_075.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04249513368505028\n",
      "Finish evaluation\n",
      "Average psnr: 20.883740080341124\n",
      "Starting training on ./data/BSD100/img_076.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02213543780214087\n",
      "Finish evaluation\n",
      "Average psnr: 27.812088707020074\n",
      "Starting training on ./data/BSD100/img_077.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.032792483294890165\n",
      "Finish evaluation\n",
      "Average psnr: 25.47274815921956\n",
      "Starting training on ./data/BSD100/img_078.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025325207168165723\n",
      "Finish evaluation\n",
      "Average psnr: 31.731708440022032\n",
      "Starting training on ./data/BSD100/img_079.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024136061601414776\n",
      "Finish evaluation\n",
      "Average psnr: 34.61951236717007\n",
      "Starting training on ./data/BSD100/img_080.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.017333671230977142\n",
      "Finish evaluation\n",
      "Average psnr: 31.637221463820445\n",
      "Starting training on ./data/BSD100/img_081.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.012837003794817295\n",
      "Finish evaluation\n",
      "Average psnr: 37.19249313172984\n",
      "Starting training on ./data/BSD100/img_082.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02471270272418242\n",
      "Finish evaluation\n",
      "Average psnr: 25.165444707673885\n",
      "Starting training on ./data/BSD100/img_083.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03597117367351852\n",
      "Finish evaluation\n",
      "Average psnr: 23.957070593254834\n",
      "Starting training on ./data/BSD100/img_084.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04332779398557147\n",
      "Finish evaluation\n",
      "Average psnr: 22.99634742576916\n",
      "Starting training on ./data/BSD100/img_085.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.032127356738465236\n",
      "Finish evaluation\n",
      "Average psnr: 27.297880003014487\n",
      "Starting training on ./data/BSD100/img_086.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04005008452057811\n",
      "Finish evaluation\n",
      "Average psnr: 22.403934914999706\n",
      "Starting training on ./data/BSD100/img_087.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02724872336065254\n",
      "Finish evaluation\n",
      "Average psnr: 29.00980828125901\n",
      "Starting training on ./data/BSD100/img_088.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025974096973596688\n",
      "Finish evaluation\n",
      "Average psnr: 33.40635652394691\n",
      "Starting training on ./data/BSD100/img_089.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.028550451341041738\n",
      "Finish evaluation\n",
      "Average psnr: 28.521454491108432\n",
      "Starting training on ./data/BSD100/img_090.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.039294767099811424\n",
      "Finish evaluation\n",
      "Average psnr: 23.405995097608468\n",
      "Starting training on ./data/BSD100/img_091.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024657443131881233\n",
      "Finish evaluation\n",
      "Average psnr: 30.929752593211074\n",
      "Starting training on ./data/BSD100/img_092.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.035073497455496844\n",
      "Finish evaluation\n",
      "Average psnr: 27.3794155908735\n",
      "Starting training on ./data/BSD100/img_093.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.028885026440274204\n",
      "Finish evaluation\n",
      "Average psnr: 34.47388533447936\n",
      "Starting training on ./data/BSD100/img_094.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03873059580471466\n",
      "Finish evaluation\n",
      "Average psnr: 28.18496741129617\n",
      "Starting training on ./data/BSD100/img_095.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03983784469937088\n",
      "Finish evaluation\n",
      "Average psnr: 28.30185944910598\n",
      "Starting training on ./data/BSD100/img_096.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04462699372199434\n",
      "Finish evaluation\n",
      "Average psnr: 18.58708756426798\n",
      "Starting training on ./data/BSD100/img_097.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024083495067561533\n",
      "Finish evaluation\n",
      "Average psnr: 27.944687011603072\n",
      "Starting training on ./data/BSD100/img_098.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03996347713465294\n",
      "Finish evaluation\n",
      "Average psnr: 28.143242082307722\n",
      "Starting training on ./data/BSD100/img_099.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03538528467316753\n",
      "Finish evaluation\n",
      "Average psnr: 28.775222398652595\n",
      "Starting training on ./data/BSD100/img_100.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03903521974819075\n",
      "Finish evaluation\n",
      "Average psnr: 26.99600793765361\n",
      "Average psnr on all images: 28.255457401386657\n"
     ]
    }
   ],
   "source": [
    "config[\"sr_factor\"] = 2\n",
    "config[\"upsample\"] = \"cubic\"\n",
    "train_test_all(\"./data/BSD100\", \"./data/BSD100/unknown_kernel_sr2\", config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Starting training on ./data/BSD100/img_001.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.033126036159043054\n",
      "Finish evaluation\n",
      "Average psnr: 24.981237982831082\n",
      "Starting training on ./data/BSD100/img_002.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024392012684594157\n",
      "Finish evaluation\n",
      "Average psnr: 28.895360709532696\n",
      "Starting training on ./data/BSD100/img_003.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03874520262240525\n",
      "Finish evaluation\n",
      "Average psnr: 23.508159859131137\n",
      "Starting training on ./data/BSD100/img_004.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.022939638485618592\n",
      "Finish evaluation\n",
      "Average psnr: 33.1000788644708\n",
      "Starting training on ./data/BSD100/img_005.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03193820527402149\n",
      "Finish evaluation\n",
      "Average psnr: 28.277303419695134\n",
      "Starting training on ./data/BSD100/img_006.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.01762224785877647\n",
      "Finish evaluation\n",
      "Average psnr: 35.04062254115477\n",
      "Starting training on ./data/BSD100/img_007.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04020757579196434\n",
      "Finish evaluation\n",
      "Average psnr: 29.448328320786977\n",
      "Starting training on ./data/BSD100/img_008.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04477253293847153\n",
      "Finish evaluation\n",
      "Average psnr: 20.483774881990783\n",
      "Starting training on ./data/BSD100/img_009.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0367362604263377\n",
      "Finish evaluation\n",
      "Average psnr: 30.006162457593383\n",
      "Starting training on ./data/BSD100/img_010.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024213077126871867\n",
      "Finish evaluation\n",
      "Average psnr: 31.491854067458277\n",
      "Starting training on ./data/BSD100/img_011.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04174829705875163\n",
      "Finish evaluation\n",
      "Average psnr: 26.850361983122344\n",
      "Starting training on ./data/BSD100/img_012.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.036277940501148215\n",
      "Finish evaluation\n",
      "Average psnr: 25.665978264230528\n",
      "Starting training on ./data/BSD100/img_013.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.027684314691675628\n",
      "Finish evaluation\n",
      "Average psnr: 33.40853452971009\n",
      "Starting training on ./data/BSD100/img_014.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.027290176907875243\n",
      "Finish evaluation\n",
      "Average psnr: 25.980144232229026\n",
      "Starting training on ./data/BSD100/img_015.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03192093761937176\n",
      "Finish evaluation\n",
      "Average psnr: 27.247735598922667\n",
      "Starting training on ./data/BSD100/img_016.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05111613922575066\n",
      "Finish evaluation\n",
      "Average psnr: 28.722231008579413\n",
      "Starting training on ./data/BSD100/img_017.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.014541594709926118\n",
      "Finish evaluation\n",
      "Average psnr: 30.977842612062915\n",
      "Starting training on ./data/BSD100/img_018.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.019621133445817042\n",
      "Finish evaluation\n",
      "Average psnr: 29.624437558398576\n",
      "Starting training on ./data/BSD100/img_019.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.031672288043093334\n",
      "Finish evaluation\n",
      "Average psnr: 26.76408313681059\n",
      "Starting training on ./data/BSD100/img_020.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.034041030489891204\n",
      "Finish evaluation\n",
      "Average psnr: 27.71753599546735\n",
      "Starting training on ./data/BSD100/img_021.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.044710313260225475\n",
      "Finish evaluation\n",
      "Average psnr: 24.69619779829437\n",
      "Starting training on ./data/BSD100/img_022.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.043982865716240126\n",
      "Finish evaluation\n",
      "Average psnr: 25.72816298652778\n",
      "Starting training on ./data/BSD100/img_023.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.038416558435402426\n",
      "Finish evaluation\n",
      "Average psnr: 21.811381150748744\n",
      "Starting training on ./data/BSD100/img_024.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.027274873130767\n",
      "Finish evaluation\n",
      "Average psnr: 28.5259476694052\n",
      "Starting training on ./data/BSD100/img_025.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.033284703574868055\n",
      "Finish evaluation\n",
      "Average psnr: 30.371941670854717\n",
      "Starting training on ./data/BSD100/img_026.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03463729645014624\n",
      "Finish evaluation\n",
      "Average psnr: 29.911756466560043\n",
      "Starting training on ./data/BSD100/img_027.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03280761025664222\n",
      "Finish evaluation\n",
      "Average psnr: 30.012289880587467\n",
      "Starting training on ./data/BSD100/img_028.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0203928209376987\n",
      "Finish evaluation\n",
      "Average psnr: 31.375450080684764\n",
      "Starting training on ./data/BSD100/img_029.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.01524592345175919\n",
      "Finish evaluation\n",
      "Average psnr: 33.483606146624545\n",
      "Starting training on ./data/BSD100/img_030.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05457638863181839\n",
      "Finish evaluation\n",
      "Average psnr: 21.308684844658444\n",
      "Starting training on ./data/BSD100/img_031.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02789867764698814\n",
      "Finish evaluation\n",
      "Average psnr: 32.26830559909638\n",
      "Starting training on ./data/BSD100/img_032.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05668620112445261\n",
      "Finish evaluation\n",
      "Average psnr: 18.36944213588708\n",
      "Starting training on ./data/BSD100/img_033.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.041368416958831165\n",
      "Finish evaluation\n",
      "Average psnr: 27.851127448209702\n",
      "Starting training on ./data/BSD100/img_034.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0320743178561604\n",
      "Finish evaluation\n",
      "Average psnr: 26.106475913153076\n",
      "Starting training on ./data/BSD100/img_035.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.019447376590929134\n",
      "Finish evaluation\n",
      "Average psnr: 36.570080030591264\n",
      "Starting training on ./data/BSD100/img_036.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03894379170524956\n",
      "Finish evaluation\n",
      "Average psnr: 29.334547743845363\n",
      "Starting training on ./data/BSD100/img_037.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.026553279243441422\n",
      "Finish evaluation\n",
      "Average psnr: 24.709973357654874\n",
      "Starting training on ./data/BSD100/img_038.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025636609613028227\n",
      "Finish evaluation\n",
      "Average psnr: 28.982995977762982\n",
      "Starting training on ./data/BSD100/img_039.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.030135484520090388\n",
      "Finish evaluation\n",
      "Average psnr: 26.37344309094594\n",
      "Starting training on ./data/BSD100/img_040.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0257461770607706\n",
      "Finish evaluation\n",
      "Average psnr: 37.30951044808542\n",
      "Starting training on ./data/BSD100/img_041.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.037564571934318385\n",
      "Finish evaluation\n",
      "Average psnr: 28.669975296534\n",
      "Starting training on ./data/BSD100/img_042.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.030480320789153362\n",
      "Finish evaluation\n",
      "Average psnr: 26.382012682801623\n",
      "Starting training on ./data/BSD100/img_043.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.026557168326007907\n",
      "Finish evaluation\n",
      "Average psnr: 27.961686250498204\n",
      "Starting training on ./data/BSD100/img_044.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03489336305327153\n",
      "Finish evaluation\n",
      "Average psnr: 28.90839969695393\n",
      "Starting training on ./data/BSD100/img_045.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.027185752142277107\n",
      "Finish evaluation\n",
      "Average psnr: 24.586109486132365\n",
      "Starting training on ./data/BSD100/img_046.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.013433011239953923\n",
      "Finish evaluation\n",
      "Average psnr: 32.78836031446549\n",
      "Starting training on ./data/BSD100/img_047.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04339090535057981\n",
      "Finish evaluation\n",
      "Average psnr: 25.32334520420641\n",
      "Starting training on ./data/BSD100/img_048.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.029962023136555316\n",
      "Finish evaluation\n",
      "Average psnr: 26.388885954563087\n",
      "Starting training on ./data/BSD100/img_049.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.05204313420219689\n",
      "Finish evaluation\n",
      "Average psnr: 29.48669027327294\n",
      "Starting training on ./data/BSD100/img_050.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0139396320585191\n",
      "Finish evaluation\n",
      "Average psnr: 32.67793480711431\n",
      "Starting training on ./data/BSD100/img_051.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03549407049194033\n",
      "Finish evaluation\n",
      "Average psnr: 26.490715030051124\n",
      "Starting training on ./data/BSD100/img_052.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03578579883811885\n",
      "Finish evaluation\n",
      "Average psnr: 24.702940270402678\n",
      "Starting training on ./data/BSD100/img_053.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.016998667225461936\n",
      "Finish evaluation\n",
      "Average psnr: 33.249683158494946\n",
      "Starting training on ./data/BSD100/img_054.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.014306782915524934\n",
      "Finish evaluation\n",
      "Average psnr: 33.90919288239735\n",
      "Starting training on ./data/BSD100/img_055.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03630479734581448\n",
      "Finish evaluation\n",
      "Average psnr: 29.98842947498373\n",
      "Starting training on ./data/BSD100/img_056.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0362197650930139\n",
      "Finish evaluation\n",
      "Average psnr: 27.361222107120867\n",
      "Starting training on ./data/BSD100/img_057.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.049092818076658565\n",
      "Finish evaluation\n",
      "Average psnr: 18.47538711253363\n",
      "Starting training on ./data/BSD100/img_058.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.023028903818180756\n",
      "Finish evaluation\n",
      "Average psnr: 28.77407698590649\n",
      "Starting training on ./data/BSD100/img_059.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.01465555428607446\n",
      "Finish evaluation\n",
      "Average psnr: 31.711024339345016\n",
      "Starting training on ./data/BSD100/img_060.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.020632683604376555\n",
      "Finish evaluation\n",
      "Average psnr: 27.896628700891203\n",
      "Starting training on ./data/BSD100/img_061.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.015131487409963496\n",
      "Finish evaluation\n",
      "Average psnr: 32.35794899244678\n",
      "Starting training on ./data/BSD100/img_062.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02231426152022767\n",
      "Finish evaluation\n",
      "Average psnr: 30.24136429687033\n",
      "Starting training on ./data/BSD100/img_063.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.028175013154092227\n",
      "Finish evaluation\n",
      "Average psnr: 36.09430232778629\n",
      "Starting training on ./data/BSD100/img_064.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.040721684835345086\n",
      "Finish evaluation\n",
      "Average psnr: 26.5884073143829\n",
      "Starting training on ./data/BSD100/img_065.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.042473730507066675\n",
      "Finish evaluation\n",
      "Average psnr: 22.951157045164962\n",
      "Starting training on ./data/BSD100/img_066.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03619388293003819\n",
      "Finish evaluation\n",
      "Average psnr: 25.6505188805377\n",
      "Starting training on ./data/BSD100/img_067.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.010823638036996241\n",
      "Finish evaluation\n",
      "Average psnr: 38.28598643032712\n",
      "Starting training on ./data/BSD100/img_068.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.06417171747057598\n",
      "Finish evaluation\n",
      "Average psnr: 23.518446382170257\n",
      "Starting training on ./data/BSD100/img_069.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03460044624425089\n",
      "Finish evaluation\n",
      "Average psnr: 23.831955872329576\n",
      "Starting training on ./data/BSD100/img_070.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.031225251302663945\n",
      "Finish evaluation\n",
      "Average psnr: 31.59156868463628\n",
      "Starting training on ./data/BSD100/img_071.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.021041873436603433\n",
      "Finish evaluation\n",
      "Average psnr: 31.423479655174702\n",
      "Starting training on ./data/BSD100/img_072.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03664411084959764\n",
      "Finish evaluation\n",
      "Average psnr: 27.74203383222776\n",
      "Starting training on ./data/BSD100/img_073.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.034119569756397086\n",
      "Finish evaluation\n",
      "Average psnr: 23.697139091195083\n",
      "Starting training on ./data/BSD100/img_074.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03278289230623711\n",
      "Finish evaluation\n",
      "Average psnr: 27.765710610525893\n",
      "Starting training on ./data/BSD100/img_075.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04285019598965839\n",
      "Finish evaluation\n",
      "Average psnr: 20.935473302690973\n",
      "Starting training on ./data/BSD100/img_076.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02186772035068919\n",
      "Finish evaluation\n",
      "Average psnr: 27.476048158611285\n",
      "Starting training on ./data/BSD100/img_077.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03300542756766091\n",
      "Finish evaluation\n",
      "Average psnr: 25.436899440134674\n",
      "Starting training on ./data/BSD100/img_078.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025460607427851625\n",
      "Finish evaluation\n",
      "Average psnr: 31.73669689239446\n",
      "Starting training on ./data/BSD100/img_079.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02677590328084131\n",
      "Finish evaluation\n",
      "Average psnr: 33.95017269080117\n",
      "Starting training on ./data/BSD100/img_080.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.01733053161595773\n",
      "Finish evaluation\n",
      "Average psnr: 31.677952273880187\n",
      "Starting training on ./data/BSD100/img_081.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.012697077769758555\n",
      "Finish evaluation\n",
      "Average psnr: 37.287533598714035\n",
      "Starting training on ./data/BSD100/img_082.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02482083155966351\n",
      "Finish evaluation\n",
      "Average psnr: 25.191777055917065\n",
      "Starting training on ./data/BSD100/img_083.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03581639598084306\n",
      "Finish evaluation\n",
      "Average psnr: 23.972608684739214\n",
      "Starting training on ./data/BSD100/img_084.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04326402296207045\n",
      "Finish evaluation\n",
      "Average psnr: 22.95818289970253\n",
      "Starting training on ./data/BSD100/img_085.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03221494238826757\n",
      "Finish evaluation\n",
      "Average psnr: 27.219699811088212\n",
      "Starting training on ./data/BSD100/img_086.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.040709141443683004\n",
      "Finish evaluation\n",
      "Average psnr: 22.50991844266755\n",
      "Starting training on ./data/BSD100/img_087.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.027448918677928046\n",
      "Finish evaluation\n",
      "Average psnr: 29.016523828959745\n",
      "Starting training on ./data/BSD100/img_088.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.025892831801905762\n",
      "Finish evaluation\n",
      "Average psnr: 33.46930430859408\n",
      "Starting training on ./data/BSD100/img_089.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02875737324888472\n",
      "Finish evaluation\n",
      "Average psnr: 28.52032147498935\n",
      "Starting training on ./data/BSD100/img_090.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.039533165481611295\n",
      "Finish evaluation\n",
      "Average psnr: 23.436423189381745\n",
      "Starting training on ./data/BSD100/img_091.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.024828309400179598\n",
      "Finish evaluation\n",
      "Average psnr: 30.923566090989787\n",
      "Starting training on ./data/BSD100/img_092.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.0349172388469348\n",
      "Finish evaluation\n",
      "Average psnr: 27.58739351602136\n",
      "Starting training on ./data/BSD100/img_093.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.02887894444692348\n",
      "Finish evaluation\n",
      "Average psnr: 34.508467065655054\n",
      "Starting training on ./data/BSD100/img_094.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.038882471707084997\n",
      "Finish evaluation\n",
      "Average psnr: 28.20320037284624\n",
      "Starting training on ./data/BSD100/img_095.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04002044740715398\n",
      "Finish evaluation\n",
      "Average psnr: 28.30083838717238\n",
      "Starting training on ./data/BSD100/img_096.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.04462161717671794\n",
      "Finish evaluation\n",
      "Average psnr: 18.4771460250247\n",
      "Starting training on ./data/BSD100/img_097.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.023683854571841204\n",
      "Finish evaluation\n",
      "Average psnr: 27.96617837071146\n",
      "Starting training on ./data/BSD100/img_098.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.039569194934545505\n",
      "Finish evaluation\n",
      "Average psnr: 28.220597363411983\n",
      "Starting training on ./data/BSD100/img_099.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03485144632970597\n",
      "Finish evaluation\n",
      "Average psnr: 28.708333523403606\n",
      "Starting training on ./data/BSD100/img_100.png with resolution factor 2\n",
      "Done training.\n",
      "Avg training loss is 0.03889418654672766\n",
      "Finish evaluation\n",
      "Average psnr: 27.05223911810503\n",
      "Average psnr on all images: 28.255093037954094\n"
     ]
    }
   ],
   "source": [
    "config[\"sr_factor\"] = 2\n",
    "config[\"upsample\"] = \"pixelshuffle\"\n",
    "train_test_all(\"./data/BSD100\", \"./data/BSD100/unknown_kernel_sr2\", config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Starting training on ./data/BSD100/img_001.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07200661578243321\n",
      "Finish evaluation\n",
      "Average psnr: 21.623077946052316\n",
      "Starting training on ./data/BSD100/img_002.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06548602834786518\n",
      "Finish evaluation\n",
      "Average psnr: 25.41052172521381\n",
      "Starting training on ./data/BSD100/img_003.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06657994979310154\n",
      "Finish evaluation\n",
      "Average psnr: 23.802377922701695\n",
      "Starting training on ./data/BSD100/img_004.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06280944300907673\n",
      "Finish evaluation\n",
      "Average psnr: 27.369828932934553\n",
      "Starting training on ./data/BSD100/img_005.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07594232205854784\n",
      "Finish evaluation\n",
      "Average psnr: 22.362145383188654\n",
      "Starting training on ./data/BSD100/img_006.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05904623644776864\n",
      "Finish evaluation\n",
      "Average psnr: 29.340175572892562\n",
      "Starting training on ./data/BSD100/img_007.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07049700248949599\n",
      "Finish evaluation\n",
      "Average psnr: 23.563404070342536\n",
      "Starting training on ./data/BSD100/img_008.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05999770229405696\n",
      "Finish evaluation\n",
      "Average psnr: 21.181927484724493\n",
      "Starting training on ./data/BSD100/img_009.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07757651193602251\n",
      "Finish evaluation\n",
      "Average psnr: 24.3511693638276\n",
      "Starting training on ./data/BSD100/img_010.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.054124066071345074\n",
      "Finish evaluation\n",
      "Average psnr: 26.280922835016977\n",
      "Starting training on ./data/BSD100/img_011.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.11724870570815436\n",
      "Finish evaluation\n",
      "Average psnr: 20.65428335281235\n",
      "Starting training on ./data/BSD100/img_012.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04499677786290055\n",
      "Finish evaluation\n",
      "Average psnr: 23.981401405577966\n",
      "Starting training on ./data/BSD100/img_013.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06481738502878955\n",
      "Finish evaluation\n",
      "Average psnr: 27.644740556929616\n",
      "Starting training on ./data/BSD100/img_014.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05998108919599269\n",
      "Finish evaluation\n",
      "Average psnr: 25.925878632273324\n",
      "Starting training on ./data/BSD100/img_015.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.062279082410553896\n",
      "Finish evaluation\n",
      "Average psnr: 22.947740259976417\n",
      "Starting training on ./data/BSD100/img_016.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08137161439598196\n",
      "Finish evaluation\n",
      "Average psnr: 20.238512252712745\n",
      "Starting training on ./data/BSD100/img_017.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04394932782812284\n",
      "Finish evaluation\n",
      "Average psnr: 28.33913312830578\n",
      "Starting training on ./data/BSD100/img_018.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04698094801221153\n",
      "Finish evaluation\n",
      "Average psnr: 29.3450142941106\n",
      "Starting training on ./data/BSD100/img_019.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08115558023795043\n",
      "Finish evaluation\n",
      "Average psnr: 23.978753082947016\n",
      "Starting training on ./data/BSD100/img_020.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07389782188404904\n",
      "Finish evaluation\n",
      "Average psnr: 23.27993247041876\n",
      "Starting training on ./data/BSD100/img_021.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08763721924607117\n",
      "Finish evaluation\n",
      "Average psnr: 20.07484415081876\n",
      "Starting training on ./data/BSD100/img_022.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09604951436861907\n",
      "Finish evaluation\n",
      "Average psnr: 20.2303047125625\n",
      "Starting training on ./data/BSD100/img_023.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06081267306120089\n",
      "Finish evaluation\n",
      "Average psnr: 22.27029439129747\n",
      "Starting training on ./data/BSD100/img_024.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07241836496361412\n",
      "Finish evaluation\n",
      "Average psnr: 22.039490276178487\n",
      "Starting training on ./data/BSD100/img_025.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08269262398676117\n",
      "Finish evaluation\n",
      "Average psnr: 24.167126490022884\n",
      "Starting training on ./data/BSD100/img_026.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06934110241213648\n",
      "Finish evaluation\n",
      "Average psnr: 24.399014525409445\n",
      "Starting training on ./data/BSD100/img_027.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07026342398459369\n",
      "Finish evaluation\n",
      "Average psnr: 24.99953251880545\n",
      "Starting training on ./data/BSD100/img_028.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04133974436191049\n",
      "Finish evaluation\n",
      "Average psnr: 25.375193053513833\n",
      "Starting training on ./data/BSD100/img_029.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06017239701629865\n",
      "Finish evaluation\n",
      "Average psnr: 26.56259765419327\n",
      "Starting training on ./data/BSD100/img_030.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09642724921502689\n",
      "Finish evaluation\n",
      "Average psnr: 19.022664309630258\n",
      "Starting training on ./data/BSD100/img_031.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06121217953686667\n",
      "Finish evaluation\n",
      "Average psnr: 26.991116032722616\n",
      "Starting training on ./data/BSD100/img_032.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05702714762180158\n",
      "Finish evaluation\n",
      "Average psnr: 20.07978919342784\n",
      "Starting training on ./data/BSD100/img_033.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0727945267416463\n",
      "Finish evaluation\n",
      "Average psnr: 23.935502959962527\n",
      "Starting training on ./data/BSD100/img_034.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0661757034387919\n",
      "Finish evaluation\n",
      "Average psnr: 22.947889889135492\n",
      "Starting training on ./data/BSD100/img_035.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06800347988927129\n",
      "Finish evaluation\n",
      "Average psnr: 29.59503261008127\n",
      "Starting training on ./data/BSD100/img_036.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09545262113656147\n",
      "Finish evaluation\n",
      "Average psnr: 22.309086724898094\n",
      "Starting training on ./data/BSD100/img_037.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.032783141710085444\n",
      "Finish evaluation\n",
      "Average psnr: 24.36385413297193\n",
      "Starting training on ./data/BSD100/img_038.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07286048864964212\n",
      "Finish evaluation\n",
      "Average psnr: 23.67190878572565\n",
      "Starting training on ./data/BSD100/img_039.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06448139298227754\n",
      "Finish evaluation\n",
      "Average psnr: 25.806721921098912\n",
      "Starting training on ./data/BSD100/img_040.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06927376458107835\n",
      "Finish evaluation\n",
      "Average psnr: 27.54155305252711\n",
      "Starting training on ./data/BSD100/img_041.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08481299307307985\n",
      "Finish evaluation\n",
      "Average psnr: 23.625810640903417\n",
      "Starting training on ./data/BSD100/img_042.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0820569823136424\n",
      "Finish evaluation\n",
      "Average psnr: 22.919320090527187\n",
      "Starting training on ./data/BSD100/img_043.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05942255955668959\n",
      "Finish evaluation\n",
      "Average psnr: 24.077758121281214\n",
      "Starting training on ./data/BSD100/img_044.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08212580399052931\n",
      "Finish evaluation\n",
      "Average psnr: 23.403056634594137\n",
      "Starting training on ./data/BSD100/img_045.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06832505224069746\n",
      "Finish evaluation\n",
      "Average psnr: 21.47659755841945\n",
      "Starting training on ./data/BSD100/img_046.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.031964874522078156\n",
      "Finish evaluation\n",
      "Average psnr: 29.237572315642563\n",
      "Starting training on ./data/BSD100/img_047.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07909651436280496\n",
      "Finish evaluation\n",
      "Average psnr: 21.292276270339123\n",
      "Starting training on ./data/BSD100/img_048.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06451828147072604\n",
      "Finish evaluation\n",
      "Average psnr: 22.699412623087557\n",
      "Starting training on ./data/BSD100/img_049.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.10289646397427757\n",
      "Finish evaluation\n",
      "Average psnr: 21.34440241154447\n",
      "Starting training on ./data/BSD100/img_050.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04408963957783019\n",
      "Finish evaluation\n",
      "Average psnr: 29.494285958883655\n",
      "Starting training on ./data/BSD100/img_051.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07649028220094077\n",
      "Finish evaluation\n",
      "Average psnr: 22.839560548320165\n",
      "Starting training on ./data/BSD100/img_052.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08280497523817686\n",
      "Finish evaluation\n",
      "Average psnr: 18.517715551700316\n",
      "Starting training on ./data/BSD100/img_053.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04611782672455405\n",
      "Finish evaluation\n",
      "Average psnr: 29.19437297237976\n",
      "Starting training on ./data/BSD100/img_054.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.045746107484297\n",
      "Finish evaluation\n",
      "Average psnr: 27.76458622724636\n",
      "Starting training on ./data/BSD100/img_055.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.080500346045978\n",
      "Finish evaluation\n",
      "Average psnr: 24.410013343092274\n",
      "Starting training on ./data/BSD100/img_056.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08581316423150573\n",
      "Finish evaluation\n",
      "Average psnr: 20.573473549487318\n",
      "Starting training on ./data/BSD100/img_057.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0873609082312277\n",
      "Finish evaluation\n",
      "Average psnr: 17.636804343294557\n",
      "Starting training on ./data/BSD100/img_058.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06405356268186381\n",
      "Finish evaluation\n",
      "Average psnr: 23.602602705915842\n",
      "Starting training on ./data/BSD100/img_059.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.032743188165275765\n",
      "Finish evaluation\n",
      "Average psnr: 27.916627994784893\n",
      "Starting training on ./data/BSD100/img_060.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.052227071403424336\n",
      "Finish evaluation\n",
      "Average psnr: 26.142577478100783\n",
      "Starting training on ./data/BSD100/img_061.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.036886272951960564\n",
      "Finish evaluation\n",
      "Average psnr: 27.929928880165427\n",
      "Starting training on ./data/BSD100/img_062.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05405878482183608\n",
      "Finish evaluation\n",
      "Average psnr: 26.04823575667276\n",
      "Starting training on ./data/BSD100/img_063.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07814672316360001\n",
      "Finish evaluation\n",
      "Average psnr: 26.17328928608555\n",
      "Starting training on ./data/BSD100/img_064.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06939054132983236\n",
      "Finish evaluation\n",
      "Average psnr: 22.352115259214195\n",
      "Starting training on ./data/BSD100/img_065.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07480876782152912\n",
      "Finish evaluation\n",
      "Average psnr: 24.478042979927658\n",
      "Starting training on ./data/BSD100/img_066.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08526287972927094\n",
      "Finish evaluation\n",
      "Average psnr: 25.44703428424585\n",
      "Starting training on ./data/BSD100/img_067.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04916225462266714\n",
      "Finish evaluation\n",
      "Average psnr: 27.927573211935538\n",
      "Starting training on ./data/BSD100/img_068.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09988461501232468\n",
      "Finish evaluation\n",
      "Average psnr: 19.399703193130033\n",
      "Starting training on ./data/BSD100/img_069.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0683659125894013\n",
      "Finish evaluation\n",
      "Average psnr: 21.366978163229476\n",
      "Starting training on ./data/BSD100/img_070.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06504662261150851\n",
      "Finish evaluation\n",
      "Average psnr: 26.032315137185673\n",
      "Starting training on ./data/BSD100/img_071.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04930602382905412\n",
      "Finish evaluation\n",
      "Average psnr: 27.649141657551006\n",
      "Starting training on ./data/BSD100/img_072.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07199185585031415\n",
      "Finish evaluation\n",
      "Average psnr: 24.216017376842046\n",
      "Starting training on ./data/BSD100/img_073.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.051169979653441076\n",
      "Finish evaluation\n",
      "Average psnr: 24.507462059621584\n",
      "Starting training on ./data/BSD100/img_074.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08577450232045485\n",
      "Finish evaluation\n",
      "Average psnr: 24.864178921960686\n",
      "Starting training on ./data/BSD100/img_075.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08166416970515016\n",
      "Finish evaluation\n",
      "Average psnr: 22.12745142206102\n",
      "Starting training on ./data/BSD100/img_076.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.050560840949563694\n",
      "Finish evaluation\n",
      "Average psnr: 26.48638603670754\n",
      "Starting training on ./data/BSD100/img_077.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05991823130314893\n",
      "Finish evaluation\n",
      "Average psnr: 22.673518244403787\n",
      "Starting training on ./data/BSD100/img_078.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06708205052384056\n",
      "Finish evaluation\n",
      "Average psnr: 27.141291207398343\n",
      "Starting training on ./data/BSD100/img_079.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07942816519206113\n",
      "Finish evaluation\n",
      "Average psnr: 24.284573347068765\n",
      "Starting training on ./data/BSD100/img_080.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04068339418730523\n",
      "Finish evaluation\n",
      "Average psnr: 26.324380925793122\n",
      "Starting training on ./data/BSD100/img_081.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04859447468182828\n",
      "Finish evaluation\n",
      "Average psnr: 30.374542941638396\n",
      "Starting training on ./data/BSD100/img_082.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.042915665664442694\n",
      "Finish evaluation\n",
      "Average psnr: 24.561385555789318\n",
      "Starting training on ./data/BSD100/img_083.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0536879572537866\n",
      "Finish evaluation\n",
      "Average psnr: 19.96364202886298\n",
      "Starting training on ./data/BSD100/img_084.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06392534892305289\n",
      "Finish evaluation\n",
      "Average psnr: 19.29794641463201\n",
      "Starting training on ./data/BSD100/img_085.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0937720316618976\n",
      "Finish evaluation\n",
      "Average psnr: 22.13152900391258\n",
      "Starting training on ./data/BSD100/img_086.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06867437407669455\n",
      "Finish evaluation\n",
      "Average psnr: 23.46513453409535\n",
      "Starting training on ./data/BSD100/img_087.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06454102145415722\n",
      "Finish evaluation\n",
      "Average psnr: 25.897311282266887\n",
      "Starting training on ./data/BSD100/img_088.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05585398871709805\n",
      "Finish evaluation\n",
      "Average psnr: 27.487117162383324\n",
      "Starting training on ./data/BSD100/img_089.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06376692774419737\n",
      "Finish evaluation\n",
      "Average psnr: 25.185969072520923\n",
      "Starting training on ./data/BSD100/img_090.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.047215743894034094\n",
      "Finish evaluation\n",
      "Average psnr: 24.10186010781492\n",
      "Starting training on ./data/BSD100/img_091.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05699210735683394\n",
      "Finish evaluation\n",
      "Average psnr: 25.796405591026243\n",
      "Starting training on ./data/BSD100/img_092.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.077910848183207\n",
      "Finish evaluation\n",
      "Average psnr: 24.231140009578553\n",
      "Starting training on ./data/BSD100/img_093.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05474526682260013\n",
      "Finish evaluation\n",
      "Average psnr: 26.84541060211929\n",
      "Starting training on ./data/BSD100/img_094.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08658717281304963\n",
      "Finish evaluation\n",
      "Average psnr: 23.814888095511357\n",
      "Starting training on ./data/BSD100/img_095.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06771123988351019\n",
      "Finish evaluation\n",
      "Average psnr: 23.47862295651592\n",
      "Starting training on ./data/BSD100/img_096.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05043765196189432\n",
      "Finish evaluation\n",
      "Average psnr: 20.102677670947912\n",
      "Starting training on ./data/BSD100/img_097.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.044336195020834995\n",
      "Finish evaluation\n",
      "Average psnr: 23.97276271684056\n",
      "Starting training on ./data/BSD100/img_098.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09819797821121641\n",
      "Finish evaluation\n",
      "Average psnr: 23.057391065567383\n",
      "Starting training on ./data/BSD100/img_099.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08615329902213399\n",
      "Finish evaluation\n",
      "Average psnr: 22.994337969550493\n",
      "Starting training on ./data/BSD100/img_100.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08275012517034418\n",
      "Finish evaluation\n",
      "Average psnr: 22.637350402358692\n",
      "Average psnr on all images: 24.230003279326215\n"
     ]
    }
   ],
   "source": [
    "config[\"sr_factor\"] = 4\n",
    "config[\"upsample\"] = \"cubic\"\n",
    "train_test_all(\"./data/BSD100\", \"./data/BSD100/unknown_kernel_sr4\", config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Starting training on ./data/BSD100/img_001.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07328034896809275\n",
      "Finish evaluation\n",
      "Average psnr: 22.593490062691227\n",
      "Starting training on ./data/BSD100/img_002.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07694224091154514\n",
      "Finish evaluation\n",
      "Average psnr: 25.950894437934306\n",
      "Starting training on ./data/BSD100/img_003.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.067067636306038\n",
      "Finish evaluation\n",
      "Average psnr: 24.763661155237333\n",
      "Starting training on ./data/BSD100/img_004.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05857999877321838\n",
      "Finish evaluation\n",
      "Average psnr: 28.956380655675474\n",
      "Starting training on ./data/BSD100/img_005.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08428487045192483\n",
      "Finish evaluation\n",
      "Average psnr: 23.372173258919826\n",
      "Starting training on ./data/BSD100/img_006.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06512939336128754\n",
      "Finish evaluation\n",
      "Average psnr: 30.123623075220184\n",
      "Starting training on ./data/BSD100/img_007.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06975772703933243\n",
      "Finish evaluation\n",
      "Average psnr: 24.570655164284517\n",
      "Starting training on ./data/BSD100/img_008.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06065302788473592\n",
      "Finish evaluation\n",
      "Average psnr: 22.207434274228483\n",
      "Starting training on ./data/BSD100/img_009.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07317738035822859\n",
      "Finish evaluation\n",
      "Average psnr: 25.62383035229883\n",
      "Starting training on ./data/BSD100/img_010.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05076529329070951\n",
      "Finish evaluation\n",
      "Average psnr: 27.325374946856996\n",
      "Starting training on ./data/BSD100/img_011.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.117596736122476\n",
      "Finish evaluation\n",
      "Average psnr: 21.931004377021697\n",
      "Starting training on ./data/BSD100/img_012.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0465339680045548\n",
      "Finish evaluation\n",
      "Average psnr: 25.10328706831823\n",
      "Starting training on ./data/BSD100/img_013.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06825046204399354\n",
      "Finish evaluation\n",
      "Average psnr: 28.24043396928721\n",
      "Starting training on ./data/BSD100/img_014.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05704068588922814\n",
      "Finish evaluation\n",
      "Average psnr: 26.94272203845317\n",
      "Starting training on ./data/BSD100/img_015.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06228933383775229\n",
      "Finish evaluation\n",
      "Average psnr: 23.98598318907871\n",
      "Starting training on ./data/BSD100/img_016.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0854141064135745\n",
      "Finish evaluation\n",
      "Average psnr: 21.42820400606893\n",
      "Starting training on ./data/BSD100/img_017.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.040751353145973515\n",
      "Finish evaluation\n",
      "Average psnr: 29.99151629028669\n",
      "Starting training on ./data/BSD100/img_018.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05180306402542213\n",
      "Finish evaluation\n",
      "Average psnr: 30.256139825226974\n",
      "Starting training on ./data/BSD100/img_019.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07507218881556303\n",
      "Finish evaluation\n",
      "Average psnr: 23.976984916177425\n",
      "Starting training on ./data/BSD100/img_020.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07957104637776272\n",
      "Finish evaluation\n",
      "Average psnr: 24.239518629354443\n",
      "Starting training on ./data/BSD100/img_021.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09052871595514883\n",
      "Finish evaluation\n",
      "Average psnr: 19.91557257665139\n",
      "Starting training on ./data/BSD100/img_022.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0928258502321078\n",
      "Finish evaluation\n",
      "Average psnr: 20.22200822009762\n",
      "Starting training on ./data/BSD100/img_023.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06233262469862948\n",
      "Finish evaluation\n",
      "Average psnr: 23.143474227830545\n",
      "Starting training on ./data/BSD100/img_024.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07359668405929415\n",
      "Finish evaluation\n",
      "Average psnr: 23.034684946950595\n",
      "Starting training on ./data/BSD100/img_025.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08084015515033562\n",
      "Finish evaluation\n",
      "Average psnr: 25.08377660738994\n",
      "Starting training on ./data/BSD100/img_026.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06468765422849372\n",
      "Finish evaluation\n",
      "Average psnr: 25.685348892883226\n",
      "Starting training on ./data/BSD100/img_027.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07523581020460271\n",
      "Finish evaluation\n",
      "Average psnr: 26.125597123507767\n",
      "Starting training on ./data/BSD100/img_028.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04228221379810631\n",
      "Finish evaluation\n",
      "Average psnr: 26.30672637816795\n",
      "Starting training on ./data/BSD100/img_029.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04488885834222973\n",
      "Finish evaluation\n",
      "Average psnr: 28.074195015093427\n",
      "Starting training on ./data/BSD100/img_030.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09071971192070753\n",
      "Finish evaluation\n",
      "Average psnr: 19.09653931101859\n",
      "Starting training on ./data/BSD100/img_031.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.058435898735234054\n",
      "Finish evaluation\n",
      "Average psnr: 28.116234949755995\n",
      "Starting training on ./data/BSD100/img_032.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05615138671923392\n",
      "Finish evaluation\n",
      "Average psnr: 19.047246851172815\n",
      "Starting training on ./data/BSD100/img_033.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07498526462528965\n",
      "Finish evaluation\n",
      "Average psnr: 23.83396638206778\n",
      "Starting training on ./data/BSD100/img_034.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06392698476810267\n",
      "Finish evaluation\n",
      "Average psnr: 22.921494187890044\n",
      "Starting training on ./data/BSD100/img_035.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06837332980836382\n",
      "Finish evaluation\n",
      "Average psnr: 30.32496145868653\n",
      "Starting training on ./data/BSD100/img_036.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09917379550562047\n",
      "Finish evaluation\n",
      "Average psnr: 23.366776534804764\n",
      "Starting training on ./data/BSD100/img_037.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04427016784649084\n",
      "Finish evaluation\n",
      "Average psnr: 25.205758322996903\n",
      "Starting training on ./data/BSD100/img_038.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07535283521998047\n",
      "Finish evaluation\n",
      "Average psnr: 24.56653988344732\n",
      "Starting training on ./data/BSD100/img_039.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06489521643091546\n",
      "Finish evaluation\n",
      "Average psnr: 26.852286150321298\n",
      "Starting training on ./data/BSD100/img_040.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07541209344964216\n",
      "Finish evaluation\n",
      "Average psnr: 28.450879263349528\n",
      "Starting training on ./data/BSD100/img_041.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08508254790512643\n",
      "Finish evaluation\n",
      "Average psnr: 24.605024157687975\n",
      "Starting training on ./data/BSD100/img_042.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0772413676327998\n",
      "Finish evaluation\n",
      "Average psnr: 24.14317110594382\n",
      "Starting training on ./data/BSD100/img_043.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.061392497013110926\n",
      "Finish evaluation\n",
      "Average psnr: 25.051349554731516\n",
      "Starting training on ./data/BSD100/img_044.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08088366388536916\n",
      "Finish evaluation\n",
      "Average psnr: 24.40190003810356\n",
      "Starting training on ./data/BSD100/img_045.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06599639540556634\n",
      "Finish evaluation\n",
      "Average psnr: 21.515414617353294\n",
      "Starting training on ./data/BSD100/img_046.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.03387304391748834\n",
      "Finish evaluation\n",
      "Average psnr: 30.219891844681932\n",
      "Starting training on ./data/BSD100/img_047.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08128112916013983\n",
      "Finish evaluation\n",
      "Average psnr: 21.24157916035633\n",
      "Starting training on ./data/BSD100/img_048.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06309017808278009\n",
      "Finish evaluation\n",
      "Average psnr: 23.618353441109686\n",
      "Starting training on ./data/BSD100/img_049.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.10843422927773826\n",
      "Finish evaluation\n",
      "Average psnr: 22.257298799036512\n",
      "Starting training on ./data/BSD100/img_050.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.049746166656513026\n",
      "Finish evaluation\n",
      "Average psnr: 30.37931923268236\n",
      "Starting training on ./data/BSD100/img_051.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07157894799319825\n",
      "Finish evaluation\n",
      "Average psnr: 23.87897202050975\n",
      "Starting training on ./data/BSD100/img_052.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0830727707557749\n",
      "Finish evaluation\n",
      "Average psnr: 19.5207542639646\n",
      "Starting training on ./data/BSD100/img_053.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.03501201810149273\n",
      "Finish evaluation\n",
      "Average psnr: 30.497956636677685\n",
      "Starting training on ./data/BSD100/img_054.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.03130846957464029\n",
      "Finish evaluation\n",
      "Average psnr: 31.28294198715858\n",
      "Starting training on ./data/BSD100/img_055.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08213955934832592\n",
      "Finish evaluation\n",
      "Average psnr: 25.278028715916925\n",
      "Starting training on ./data/BSD100/img_056.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08712170228804691\n",
      "Finish evaluation\n",
      "Average psnr: 21.708415114172013\n",
      "Starting training on ./data/BSD100/img_057.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09021851176967716\n",
      "Finish evaluation\n",
      "Average psnr: 18.60261295019548\n",
      "Starting training on ./data/BSD100/img_058.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06241692613699649\n",
      "Finish evaluation\n",
      "Average psnr: 24.500915013017316\n",
      "Starting training on ./data/BSD100/img_059.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.03798699429682871\n",
      "Finish evaluation\n",
      "Average psnr: 28.917977388366847\n",
      "Starting training on ./data/BSD100/img_060.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06241601889971459\n",
      "Finish evaluation\n",
      "Average psnr: 26.83907053806807\n",
      "Starting training on ./data/BSD100/img_061.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.03190315537855472\n",
      "Finish evaluation\n",
      "Average psnr: 28.903491547974717\n",
      "Starting training on ./data/BSD100/img_062.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0520904676453902\n",
      "Finish evaluation\n",
      "Average psnr: 27.012401740931782\n",
      "Starting training on ./data/BSD100/img_063.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07647922734665398\n",
      "Finish evaluation\n",
      "Average psnr: 26.39336527399852\n",
      "Starting training on ./data/BSD100/img_064.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0730166385448215\n",
      "Finish evaluation\n",
      "Average psnr: 23.31188211590691\n",
      "Starting training on ./data/BSD100/img_065.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07523199713023582\n",
      "Finish evaluation\n",
      "Average psnr: 24.464795565428652\n",
      "Starting training on ./data/BSD100/img_066.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0881696881560406\n",
      "Finish evaluation\n",
      "Average psnr: 26.408463065000305\n",
      "Starting training on ./data/BSD100/img_067.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04241570068689266\n",
      "Finish evaluation\n",
      "Average psnr: 30.320756614987154\n",
      "Starting training on ./data/BSD100/img_068.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09971818113976186\n",
      "Finish evaluation\n",
      "Average psnr: 20.387989390773946\n",
      "Starting training on ./data/BSD100/img_069.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.061597593147123215\n",
      "Finish evaluation\n",
      "Average psnr: 22.42718287331896\n",
      "Starting training on ./data/BSD100/img_070.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06505800075460189\n",
      "Finish evaluation\n",
      "Average psnr: 26.00596436351728\n",
      "Starting training on ./data/BSD100/img_071.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04214735360502606\n",
      "Finish evaluation\n",
      "Average psnr: 27.832850057611594\n",
      "Starting training on ./data/BSD100/img_072.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07231021565523478\n",
      "Finish evaluation\n",
      "Average psnr: 24.21156830657199\n",
      "Starting training on ./data/BSD100/img_073.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05031157222272146\n",
      "Finish evaluation\n",
      "Average psnr: 24.49965290595928\n",
      "Starting training on ./data/BSD100/img_074.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08496324891353597\n",
      "Finish evaluation\n",
      "Average psnr: 24.893668031233688\n",
      "Starting training on ./data/BSD100/img_075.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08342339186975271\n",
      "Finish evaluation\n",
      "Average psnr: 23.14116347602216\n",
      "Starting training on ./data/BSD100/img_076.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04859125523800307\n",
      "Finish evaluation\n",
      "Average psnr: 27.57342686541693\n",
      "Starting training on ./data/BSD100/img_077.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.056272748783968464\n",
      "Finish evaluation\n",
      "Average psnr: 23.558893103123545\n",
      "Starting training on ./data/BSD100/img_078.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06333789631429285\n",
      "Finish evaluation\n",
      "Average psnr: 28.159514464840406\n",
      "Starting training on ./data/BSD100/img_079.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.07524260227559226\n",
      "Finish evaluation\n",
      "Average psnr: 25.249256324673652\n",
      "Starting training on ./data/BSD100/img_080.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04330977985616958\n",
      "Finish evaluation\n",
      "Average psnr: 26.910611701663857\n",
      "Starting training on ./data/BSD100/img_081.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04509093271254903\n",
      "Finish evaluation\n",
      "Average psnr: 30.779504774368604\n",
      "Starting training on ./data/BSD100/img_082.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.04300257245465965\n",
      "Finish evaluation\n",
      "Average psnr: 25.64814608053972\n",
      "Starting training on ./data/BSD100/img_083.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05829611254653128\n",
      "Finish evaluation\n",
      "Average psnr: 21.971662943829603\n",
      "Starting training on ./data/BSD100/img_084.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06375354207535781\n",
      "Finish evaluation\n",
      "Average psnr: 21.35942678572645\n",
      "Starting training on ./data/BSD100/img_085.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09049089311963261\n",
      "Finish evaluation\n",
      "Average psnr: 24.10540854250469\n",
      "Starting training on ./data/BSD100/img_086.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.06389584189446845\n",
      "Finish evaluation\n",
      "Average psnr: 23.506579631751205\n",
      "Starting training on ./data/BSD100/img_087.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.060713117665583544\n",
      "Finish evaluation\n",
      "Average psnr: 25.95574695985575\n",
      "Starting training on ./data/BSD100/img_088.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0601653624510411\n",
      "Finish evaluation\n",
      "Average psnr: 27.471750408128184\n",
      "Starting training on ./data/BSD100/img_089.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05911732431833107\n",
      "Finish evaluation\n",
      "Average psnr: 26.326553728867268\n",
      "Starting training on ./data/BSD100/img_090.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05037944358174164\n",
      "Finish evaluation\n",
      "Average psnr: 24.088207728067587\n",
      "Starting training on ./data/BSD100/img_091.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05160107365855486\n",
      "Finish evaluation\n",
      "Average psnr: 27.836061471522854\n",
      "Starting training on ./data/BSD100/img_092.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0802290521857172\n",
      "Finish evaluation\n",
      "Average psnr: 24.148169323602342\n",
      "Starting training on ./data/BSD100/img_093.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05423833525711947\n",
      "Finish evaluation\n",
      "Average psnr: 28.248741825738026\n",
      "Starting training on ./data/BSD100/img_094.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08903614638170393\n",
      "Finish evaluation\n",
      "Average psnr: 23.79380951284579\n",
      "Starting training on ./data/BSD100/img_095.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.0644882789785319\n",
      "Finish evaluation\n",
      "Average psnr: 23.503500191732073\n",
      "Starting training on ./data/BSD100/img_096.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.05013846382867582\n",
      "Finish evaluation\n",
      "Average psnr: 21.022750161732823\n",
      "Starting training on ./data/BSD100/img_097.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.042226206474375014\n",
      "Finish evaluation\n",
      "Average psnr: 25.011330276189298\n",
      "Starting training on ./data/BSD100/img_098.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.09570681491848265\n",
      "Finish evaluation\n",
      "Average psnr: 24.049856809552686\n",
      "Starting training on ./data/BSD100/img_099.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08759124713516471\n",
      "Finish evaluation\n",
      "Average psnr: 23.031530980383724\n",
      "Starting training on ./data/BSD100/img_100.png with resolution factor 4\n",
      "Done training.\n",
      "Avg training loss is 0.08393310877208662\n",
      "Finish evaluation\n",
      "Average psnr: 23.6149004104051\n",
      "Average psnr on all images: 25.065588618927377\n"
     ]
    }
   ],
   "source": [
    "config[\"upsample\"] = \"pixelshuffle\"\n",
    "train_test_all(\"./data/BSD100\", \"./data/BSD100/unknown_kernel_sr4\", config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "metadata": {
     "collapsed": false
    },
    "source": []
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
